package cn.yinyu.queue.module.ecg.enums;

import cn.hutool.core.util.ObjUtil;
import cn.yinyu.queue.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 检查状态枚举
 *
 * @author 垠域源码
 */
@Getter
@AllArgsConstructor
public enum DevRentStateEnum implements IntArrayValuable {
    FREE(0, "待装机"),
    READY(5, "已领取"),
    INSTALLED(10, "已装机"),
    DISMANTLED(20, "已拆机"),
    DATAENTERED(25, "已录入"),
    READY_CANCELLED(30, "领用放弃"),
    INSTALL_CANCELLED(35, "安装放弃"),
    LOST(40, "已遗失"),
    DAMAGED(42, "已损毁"),
    ROUTINE_CANCELLED(50, "常规检查放弃"),
    ROUTINE_FINISH( 60, "常规检查完成");

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DevRentStateEnum::getState).toArray();

    /**
     * 状态值
     */
    private final Integer state;
    /**
     * 状态名
     */
    private final String name;

    @Override
    public int[] array() {
        return ARRAYS;
    }

    public boolean isEqual(Integer state) {
        return ObjUtil.equal(this.state, state);
    }
}
